#ifndef TIMER_CONFIG_H__
#define TIMER_CONFIG_H__

#include "stm32f4xx_hal.h"

void MX_TIM3_Init(void);
void MX_TIM4_Init(void);
void MX_TIM6_Init(void);

extern TIM_HandleTypeDef htim3;
extern TIM_HandleTypeDef htim4;
extern TIM_HandleTypeDef htim6;

// 电机PWM定时器
#define PWM_CHANNEL_1 TIM_CHANNEL_1
#define PWM_CHANNEL_2 TIM_CHANNEL_2

/* 累计 TIM_Period个后产生一个更新或者中断*/
/* 当定时器从0计数到PWM_PERIOD_COUNT，即为PWM_PERIOD_COUNT+1次，为一个定时周期 */
#define PWM_PERIOD_COUNT (1049)

/* 最大比较值 */
#define PWM_MAX_PERIOD_COUNT (PWM_PERIOD_COUNT - 10)

void TIM3_SetPWM_pulse(uint32_t channel, int compare);

#endif
